
var Scroll =
{
	tscroll : "",
	interval : 10,
	offset : 5,
	
	scrollUp : function(frameID, scrollAreaID)
	{
		Scroll.scrollMove(frameID, scrollAreaID, Scroll.offset);
	},

	scrollDown : function(frameID, scrollAreaID)
	{
		Scroll.scrollMove(frameID, scrollAreaID, -Scroll.offset);
	},
	
	scrollMove : function(frameID, scrollAreaID, offset)
	{
		Scroll.tscroll = setInterval("Scroll.scrollMoveAux('"+frameID+"', '"+scrollAreaID+"',"+offset+")", Scroll.interval);
	},
	
	scrollMoveAux : function(frameID, scrollAreaID, offset)
	{
		var frame = document.getElementById(frameID);
		var scrollArea = document.getElementById(scrollAreaID);
		var newTop = scrollArea.offsetTop+offset;
		var frameHeight = frame.offsetHeight;
		var scrollAreaHeight = scrollArea.offsetHeight;
		
		if( ( (offset<0) && (newTop>frameHeight-scrollAreaHeight) ) || ( (offset>0) && (newTop<=0) ) )
			scrollArea.style.top = scrollArea.offsetTop + offset + "px";
	},
	
	scrollEnd : function()
	{
		if(Scroll.tscroll)
			clearInterval(Scroll.tscroll);
	}
}

Common.addEventListener(document, "mouseup", Scroll.scrollEnd, false)